<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>">
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
		<title>无标题文档</title>
		<link rel="stylesheet" href="css/center.css" type="text/css"></link>
		<link rel="stylesheet" href="css/common.css" type="text/css"></link>
		<link rel="stylesheet" href="css/jquery-ui-1.8.5.custom.css"
			type="text/css"></link>
		<script type="text/javascript" src="javascript/center.js">
</script>
		<script type="text/javascript" src="javascript/jquery-1.4.2.js">
</script>
		<script type="text/javascript" src="javascript/jquery.treeview.js">
</script>
		<script type="text/javascript" src="javascript/jquery.cookie.js">
</script>
		<script type="text/javascript"
			src="javascript/jquery-ui-1.8.5.custom.min.js">
</script>
		<script>

</script>
		<script type="text/javascript">
$(function() {
	$("input[name='selectAll']").change(
			function() {
				$("input[name='itemCheckbox']").attr("checked",
						$(this).attr("checked"));
			})
})
function addGoods() {
	$("#addGoodsDiv").dialog( {
		modal : true,
		width:600,
		buttons : {
			'增加' : function() {
				
				if($("#goodsIngredients").val()==''){
					alert("商品配料不能为空!")
					return;
				}else  if($("#goodsBarCode").val()==''){
					alert("商品条形码不能为空!")
					return;
				}
				$("#addGoodsForm").submit();
			},
			'取消' : function() {
				$(this).dialog("close")
			}
		}
	});

}
function editGoods(goodsId){
	
	
	$.post("json/gainGoodsInfoAction",{'goodsId':goodsId,'date':new Date()},function(data){

		var goods=eval("("+data.result+")")
		$("#goodsChineseName").val(goods.goodsChineseName)
		$("#goodsEnglishName").val(goods.goodsEnglishName)
		$("#goodsAlias1").val(goods.goodsAlias1)
		$("#goodsAlias2").val(goods.goodsAlias2)
		$("#goodsBarCode2").val(goods.goodsBarCode)
		$("#goodsManufacturer").val(goods.goodsManufacturer)
		$("#goodsIngredients2").val(goods.goodsIngredients)
		$("#goodsBrandManu").val(goods.goodsBrandManu)
		$("#goodsManurAddr").val(goods.goodsManurAddr)
		$("#goodsLicense").val(goods.goodsLicense)
		$("#producerPhoneNum").val(goods.producerPhoneNum)
		$("#goodCategory").val(goods.goodcategory.goodCategoryId)
		$("#goodsId").val(goods.goodsId)
		
		$("#examine").val(goods.examine)
		$("#producerUrl").val(goods.producerUrl)
		$("#editGoodsDiv").dialog( {
			modal : true,
			width:600,
			buttons : {
			'确定' : function() {
				
				if($("#goodsIngredients2").val()==''){
					alert("商品配料不能为空!")
					return;
				}else  if($("#goodsBarCode2").val()==''){
					alert("商品条形码不能为空!")
					return;
				}
				$("#editGoodsForm").submit();
			},
			'取消' : function() {
				$(this).dialog("close")
			}
		}
		});
	})
}
function checkGoodsIngredients(ingredients){
	$("#IngredientsDetail").html(ingredients)
	$("#IngredientsDetail").dialog( {
		modal : true,
		width:400
	});
}
</script>
	</head>

	<body style="overflow: hidden">


		<table width="100%" height="100%" border="1" cellpadding="0"
			cellspacing="0">
			<tr style="height: 9%">
				<td colspan="3">
					<div>
						<jsp:include page="top.jsp"></jsp:include>
					</div>
				</td>
			</tr>
			<tr>
				<td width="171" id=frmTitle noWrap name="fmTitle" align="center"
					valign="top">
					<div>
						<jsp:include page="left.jsp"></jsp:include>
					</div>
				</td>
				<td width="9" valign="middle" bgcolor="#0a5c8e"
					onclick=switchSysBar()>
					<SPAN class=navPoint id=switchPoint title=关闭/打开左栏><img
							src="images/main_41.gif" name="img1" width=9 height=52 id=img1>
					</SPAN>
				</td>
				<td align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0"
						cellspacing="0" style="table-layout: fixed;">
						<tr>
							<td height="8" style="line-height: 8px;">
								<table width="100%" border="0" cellspacing="0" cellpadding="0"
									style="table-layout: fixed;">
									<tr>
										<td width="14">
											<img src="images/main_24.gif" width="14" height="8">
										</td>
										<td background="images/main_26.gif" style="line-height: 8px;">
											&nbsp;
										</td>
										<td width="7">
											<img src="images/main_28.gif" width="7" height="8">
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td>
								<table width="100%" height="100%" border="0" cellpadding="0"
									cellspacing="0" style="table-layout: fixed;">
									<tr valign="top">
										<td>

											<div style="margin-top: auto; margin-bottom: auto">

												<!-- -----------------------内容区开始---------------------- -->

												<table width="100%" border="0" cellspacing="0"
													cellpadding="0"
													style="margin-top: auto; margin-bottom: auto">
													<tr>
														<td height="30" background="images/tab_05.gif">
															<table width="100%" border="0" cellspacing="0"
																cellpadding="0">
																<tr>
																	<td width="12" height="30">
																		<img src="images/tab_03.gif" width="12" height="30" />
																	</td>
																	<td>
																		<table width="100%" border="0" cellspacing="0"
																			cellpadding="0">
																			<tr>
																				<td width="46%" valign="middle">
																					<table width="100%" border="0" cellspacing="0"
																						cellpadding="0">
																						<tr>
																							<td width="5%">
																								<div align="center">
																									<img src="images/tb.gif" width="16" height="16" />
																								</div>
																							</td>
																							<td width="95%" class="STYLE1">
																								<span class="STYLE3">你当前的位置</span>：信息管理-食品管理
																							</td>
																						</tr>
																					</table>
																				</td>
																				<td width="54%">
																					<table border="0" align="right" cellpadding="0"
																						cellspacing="0">
																						<tr>
																
																							<td width="60">
																								<table width="90%" border="0" cellpadding="0"
																									cellspacing="0">
																									<tr>
																										<td class="STYLE1">
																											<div align="center">
																												<img src="images/22.gif" width="14"
																													height="14" />
																											</div>
																										</td>
																										<td class="STYLE1">
																											<div align="center">
																												<a href="javascript:addGoods()">新增</a>
																											</div>
																										</td>
																									</tr>
																								</table>
																							</td>
																							
																						</tr>
																					</table>
																				</td>
																			</tr>
																		</table>
																	</td>
																	<td width="16">
																		<img src="images/tab_07.gif" width="16" height="30" />
																	</td>
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														<td>
															<table width="100%" border="0" cellspacing="0"
																cellpadding="0">

																<tr>
																	<td width="8" background="images/tab_12.gif">
																		&nbsp;
																	</td>
																	<td>
																		<table width="100%" border="0" cellpadding="0"
																			cellspacing="1" bgcolor="b5d6e6"
																			onmouseover="changeto()" onmouseout="changeback()">
																			<tr>
																				<td width="3%" height="22"
																					background="images/bg.gif" bgcolor="#FFFFFF">
																					<div align="center">
																						<input type="checkbox" name="selectAll"
																							value="checkbox" />
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">序号</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">食品名称</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">食品别名1</span>
																					</div>
																				</td>
																				<td background="images/bg.gif" bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">食品别名2</span>
																					</div>
																				</td>
																				<td background="images/bg.gif" bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">食品类别</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">条形码</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">商品配料或描述</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">商品制作厂家</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">商品制作厂家地址</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">商品商标拥有厂家</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">生产许可证</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">执行标准</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">厂家官网URL</span>
																					</div>
																				</td>
																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF">
																					<div align="center">
																						<span class="STYLE1">状态</span>
																					</div>
																				</td>


																				<td height="22" background="images/bg.gif"
																					bgcolor="#FFFFFF" class="STYLE1">
																					<div align="center">
																						基本操作
																					</div>
																				</td>
																			</tr>
																			<!-- -----------------------------------------内容行开始---------------------------------- -->
																			<s:iterator value="goodsList" var="goods"
																				status="status">

																				<tr>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center">
																							<input type="checkbox" name="itemCheckbox"
																								value="checkbox" />
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center" class="STYLE1">
																							<div align="center">
																								<s:property value="#status.index+1" />
																							</div>
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center" class="STYLE1">
																							<div align="center">
																								<s:property value="#goods.goodsChineseName" />
																								(
																								<s:property value="#goods.goodsEnglishName" />
																								)
																							</div>
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center" class="STYLE1">
																							<div align="center">
																								<s:property value="#goods.goodsAlias1" />
																							</div>
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center" class="STYLE1">
																							<div align="center">
																								<s:property value="#goods.goodsAlias2" />
																							</div>
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center" class="STYLE1">
																							<div align="center">
																								<s:property
																									value="#goods.goodcategory.goodCategoryName" />
																							</div>
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center" class="STYLE1">
																							<div align="center">
																								<s:property value="#goods.goodsBarCode" />
																							</div>
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center" class="STYLE1">
																							<div align="center">
																								<a href="javascript:checkGoodsIngredients('<s:property value="#goods.goodsIngredients" />')" style="color: red">查看配料信息</a>
																								
																							</div>
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center" class="STYLE1">
																							<div align="center">
																								<s:property value="#goods.goodsManufacturer" />
																								
																							</div>
																						</div>
																					</td>
																					
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center">
																							<span class="STYLE1"> <s:property
																									value="#goods.goodsManurAddr" /> </span>

																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center">
																							<span class="STYLE1"> <s:property
																									value="#goods.goodsBrandManu" /> </span>
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center">
																							<span class="STYLE1"> <s:property
																									value="#goods.goodsLicense" /> </span>
																						</div>
																					</td>
																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center">
																							<span class="STYLE1"> <s:property
																									value="#goods.productionStandard" /> </span>
																						</div>
																					</td>
																					<td bgcolor="#FFFFFF">
																						<div align="center">
																							<span class="STYLE1"> <s:property
																									value="#goods.producerUrl" /> </span>
																						</div>
																					</td>
																					<td bgcolor="#FFFFFF">
																						<div align="center">
																							<span class="STYLE1"> <s:if
																									test="#goods.examine">
																									已审核
																								</s:if> <s:else>
																									<font color='red'>未审核</font>
																								</s:else> </span>
																						</div>
																					</td>

																					<td height="20" bgcolor="#FFFFFF">
																						<div align="center">
																							<span class="STYLE4"><img
																									src="images/edt.gif" width="16" height="16" />
																									
																									<a href="javascript:editGoods(<s:property value='#goods.goodsId' />)">编辑</a>
																									&nbsp;
																								&nbsp;<img src="images/del.gif" width="16"
																									height="16" /><a
																								href='deleteGoodsAction?goodsId=<s:property value="#goods.goodsId"/>'>删除<a />
																							</span>
																						</div>
																					</td>
																				</tr>
																			</s:iterator>
																			<!-- -----------------------------------------内容行结束---------------------------------- -->


																		</table>
																	</td>
																	<td width="8" background="images/tab_15.gif">
																		&nbsp;
																	</td>
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														<td height="35" background="images/tab_19.gif">
															<table width="100%" border="0" cellspacing="0"
																cellpadding="0">
																<tr>
																	<td width="12" height="35">
																		<img src="images/tab_18.gif" width="12" height="35" />
																	</td>
																	<td>
																		<table width="100%" border="0" cellspacing="0"
																			cellpadding="0">
																			<tr>
																				<td class="STYLE4">
																					&nbsp;&nbsp;共有 120 条记录，当前第 1/10 页
																				</td>
																				<td>
																					<table border="0" align="right" cellpadding="0"
																						cellspacing="0">
																						<tr>
																							<td width="40">
																								<img src="images/first.gif" width="37"
																									height="15" />
																							</td>
																							<td width="45">
																								<img src="images/back.gif" width="43"
																									height="15" />
																							</td>
																							<td width="45">
																								<img src="images/next.gif" width="43"
																									height="15" />
																							</td>
																							<td width="40">
																								<img src="images/last.gif" width="37"
																									height="15" />
																							</td>
																							<td width="100">
																								<div align="center">
																									<span class="STYLE1">转到第 <input
																											name="textfield" type="text" size="4"
																											style="height: 12px; width: 20px; border: 1px solid #999999;" />
																										页 </span>
																								</div>
																							</td>
																							<td width="40">
																								<img src="images/go.gif" width="37" height="15" />
																							</td>
																						</tr>
																					</table>
																				</td>
																			</tr>
																		</table>
																	</td>
																	<td width="16">
																		<img src="images/tab_20.gif" width="16" height="35" />
																	</td>
																</tr>
															</table>
														</td>
													</tr>
												</table>


												<!-- -----------------------内容区结束---------------------- -->
											</div>
										</td>
										<td width="3" style="width: 3px; background: #0a5c8e;">
											&nbsp;
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td height="12" style="line-height: 12px;">
								<table width="100%" border="0" cellspacing="0" cellpadding="0"
									style="table-layout: fixed;">
									<tr>
										<td width="14" height="12">
											<img src="images/main_46.gif" width="14" height="12">
										</td>
										<td background="images/main_48.gif" style="line-height: 12px;">
											&nbsp;
										</td>
										<td width="7">
											<img src="images/main_50.gif" width="7" height="12">
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<div id="addGoodsDiv" title="增加商品" style="display: none;font-size: 6px">
		<form action="addGoodsAction" method="get" id="addGoodsForm">
		<table>
			<tr>
				<td>食品中文名:<input type="text" name="goods.goodsChineseName"/></td>
				<td>食品英文名:<input type="text" name="goods.goodsEnglishName"/></td>
			</tr>
			<tr>
				<td>食品别名1:<input type="text" name="goods.goodsAlias1"/></td>
				<td>食品别名2:<input type="text" name="goods.goodsAlias2"/></td>
			</tr>
			<tr>
				<td>条形码:<input type="text" name="goods.goodsBarCode" id="goodsBarCode"/></td>
				<td>制作厂家:<input type="text" name="goods.goodsManufacturer"/></td>
			</tr>
			<tr>
				<td>配料或描述（配料间用逗号隔开）:</td>
				<td>&nbsp;</td>
			</tr>
		
			<tr>
				<td colspan="2">
					<textarea rows="5" cols="50" name="goods.goodsIngredients"></textarea>
				</td>
			</tr>
			<tr>
				<td>生产许可证:<input type="text" name="goods.goodsLicense"/></td>
				<td>制作厂家地址:<input type="text" name="goods.goodsManurAddr"/></td>
			</tr>
			<tr>
				<td>商标拥有厂家:<input type="text" name="goods.goodsBrandManu"/></td>
				<td>厂家官网URL:<input type="text" name="goods.producerUrl"/></td>
			</tr>
			<tr>
					<td>厂家电话:<input type="text" name="goods.producerPhoneNum"/></td>
				<td>食品类别:
					<s:select list="goodcategories" listKey="goodCategoryId" listValue="goodCategoryName" theme="simple"  name="goods.goodcategory.goodCategoryId">
					</s:select>
				</td>
			</tr>
		</table>

	</form>
		</div>
		<div id="editGoodsDiv" title="编辑" style="display: none;font-size: 6px">
		<form action="editGoodsAction" method="post" id="editGoodsForm">
		<table>
			<tr>
				<td>食品中文名:<input type="text" name="goods.goodsChineseName" id="goodsChineseName"/></td>
				<td>食品英文名:<input type="text" name="goods.goodsEnglishName" id="goodsEnglishName"/></td>
			</tr>
			<tr>
				<td>食品别名1:<input type="text" name="goods.goodsAlias1" id="goodsAlias1"/></td>
				<td>食品别名2:<input type="text" name="goods.goodsAlias2" id="goodsAlias2"/></td>
			</tr>
			<tr>
				<td>条形码:<input type="text" name="goods.goodsBarCode" id="goodsBarCode2"/></td>
				<td>制作厂家:<input type="text" name="goods.goodsManufacturer" id="goodsManufacturer2"/></td>
			</tr>
			<tr>
				<td>配料或描述（配料间用逗号隔开）:</td>
				<td>&nbsp;</td>
			</tr>
		
			<tr>
				<td colspan="2">
					<textarea rows="5" cols="50" name="goods.goodsIngredients" id="goodsIngredients"></textarea>
				</td>
			</tr>
			<tr>
				<td>生产许可证:<input type="text" name="goods.goodsLicense" id="goodsLicense"/></td>
				<td>制作厂家地址:<input type="text" name="goods.goodsManurAddr" id="goodsManurAddr"/></td>
			</tr>
			<tr>
				<td>商标拥有厂家:<input type="text" name="goods.goodsBrandManu" id="goodsBrandManu"/></td>
				<td>厂家官网URL:<input type="text" name="goods.producerUrl" id="producerUrl"/></td>
			</tr>
			<tr>
					<td>厂家电话:<input type="text" name="goods.producerPhoneNum" id="producerPhoneNum"/></td>
				<td>食品类别:
					<s:select list="goodcategories" listKey="goodCategoryId" listValue="goodCategoryName" theme="simple"  name="goods.goodcategory.goodCategoryId" id="goodCategory">
					</s:select>
					<input  type="hidden" id="goodsId"  name="goods.goodsId"/>
					
				</td>
			</tr>
			<tr>
				<td>
					审核情况：
					<select name="goods.examine" id="examine">
						<option value="true">审核通过</option>
						<option value="false">未审核</option>
					</select>
				</td>
				<td>
				</td>
			</tr>
		</table>
		
		
	</form>
		</div>
		<div id="IngredientsDetail" style="display: none" title="查看配料信息">
		</div>
	</body>
</html>



